package com.study.java.base.lianxi;

import java.security.PublicKey;
import java.util.Arrays;

public class Array {

    public static void main(String [] args){
        byte[] name = new byte[4];
        int[] name1 = new int[2];
        short[] name2 = {1,2,3,4};
        long [] name3 = {5,7,8};
        float [] name4;
        name4 = new float[6];
        double [] name5 ={7890,876};
        boolean [] name6 ;
        name6 = new boolean[8];
        char [] name7 ={'y',5};
        String [] name8 = {"c"};
       // ti1();

        int[] shu1 = {6,2,9,0,5,2,7,8,2,6};


        //ti2_2(shu1);
        //System.out.println();
       // ti2_3(shu1);
       // ti2_4(shu1,6);
       // ti2_5(shu1,6);
        ti3(10000);
        ti3(685332);
        ti3(10000);
        ti3(8556652);
        ti3(10000);
        ti3(10000);
        ti3(10000);
        ti3(10000);
        ti3(10000);
    }
    public static void ti1( ){
        byte[] shu = new byte[6];
        int[] shu1 = {1,2,3,4,5,0,0,8,9,10};
        shu[2] = 5;
        shu[5] = 16;
        //for (int i=0; i<10;i++){
         //   System.out.println(shu1[i]);
       // }
        int i=0;
        while (i<10){
            System.out.println(shu1[i++]);
        }
    }
    public static void ti2(int[] shu2, int l){
        int i=0;
        while (i<l){
            System.out.println(shu2[i++]);
        }
    }

    public static void ti2_2(int[] shu2){
        int i=0;
        System.out.print("{");
        while (i<shu2.length){
            System.out.print(shu2[i++]);
            if(i==shu2.length) {

                System.out.print("");
            }else {
                System.out.print(",");
            }


        }
        System.out.print("}");
    }

    public static void ti2_3(int[] shu2){
        System.out.println(Arrays.toString(shu2));
    }

    public static void ti2_4(int[] shu3,int s){
        int r=0;
        for (int i=0; i<shu3.length; i++){
        System.out.println("执行"+i+"次");
        if (shu3[i]==s){
        r++;
        break;
        }
        }
        if(r>0){
        System.out.println("已存在!");
        }else{
        System.out.println("不存在!");
        }
    }


    public static void ti2_4(int[] shu3,int s, int d){
        int r=0;
        for (int i=0; i<shu3.length; i++){
            System.out.println("执行"+i+"次");
            if (shu3[i]==s){
                r++;
                break;
            }
        }
        if(r>0){
            System.out.println("已存在!");
        }else{
            System.out.println("不存在!");
        }
    }
    public static void ti2_5(int[] shu4,int d){
        int i=0, l=0;
        while (i<shu4.length){
         if(shu4[i]==d){
         l++;
         }
        }
            i++;
        if(l<1){
        System.out.println("不存在");
        }else {
         System.out.println("已存在"+l+"个");
        }
}


    public static void ti3 (int yu){
        System.out.println();
        System.out.println(yu>1000?"你好有钱啊！":"小意思...");
        System.out.println("数字金额: "+yu);
        String[] qi={"亿","千","百","十","万","千","百","十","元"};
        int[] bytes = new int[9];

        System.out.println(Arrays.toString(qi));
        System.out.print("[");


        for (int i =  bytes.length; i>0; i--) {
            bytes[i-1] = yu%10;
            yu /= 10;
        }

        for (int i = 0; i < bytes.length; i++) {
            int shu = bytes[i];
            System.out.print(shu);
            if (i!=bytes.length-1){
                System.out.print(",　");
            }
        }
        System.out.println("]");





    }









}


